#include "sm2.h"
#include "sm2_sign.h"
#include "Crypto_Types.h"
#include "Crypto_internal.h"

#define CRYPTO_START_SEC_CODE
#include "Crypto_MemMap.h"

FUNC(Std_ReturnType, CRY_CODE)
Crypto_sm2_setkey_enc(P2VAR(uint8, AUTOMATIC, CRY_APPL_DATA) key); 		/** Setup public key for SM2 encryption */
FUNC(Std_ReturnType, CRY_CODE)
Crypto_sm2_setkey_dec(P2VAR(uint8, AUTOMATIC, CRY_APPL_DATA) key);		/** Setup public key for SM2 decryption */

FUNC(Std_ReturnType, CRY_CODE)
Crypto_sm2_signature_generate(Crypto_SM2_Signer_Info *signer, const uint8_t *message, const uint32_t message_size, SM2_Signature *output)
{
	Std_ReturnType ret = E_OK;

	internal_sm2_signature_generate(signer, message, message_size, output);

	return ret;
}
FUNC(Std_ReturnType, CRY_CODE)
Crypto_sm2_signature_verify(const uint8_t sig[64], const uint8_t pub[64], const uint8_t Z_A[32], const uint8_t *message, uint32_t message_size)
{
	Std_ReturnType ret = E_OK;
	if(!internal_sm2_signature_verify(sig, pub, Z_A, message, message_size)) {
		ret = 1;
	}
	return ret;
}

FUNC(Std_ReturnType, CRY_CODE) Crypto_SM2EncryptECB(P2VAR(uint8, AUTOMATIC, CRY_APPL_DATA) key, uint8 buf[64]);
FUNC(Std_ReturnType, CRY_CODE) Crypto_SM2DecryptECB(P2VAR(uint8, AUTOMATIC, CRY_APPL_DATA) key, uint8 buf[64]);


#define CRYPTO_STOP_SEC_CODE
#include "Crypto_MemMap.h"
